/**
 * 
 */
package springbootstudy.helloworld;

import java.util.Date;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Administrator
 *
 */
@RestController
public class HelloController {

	@RequestMapping("/hello")
	public String hello() {
		return "hello-" + new Date();
	}

	@RequestMapping("/hello1")
	public String hello1() {
		return "hello1-" + new Date();
	}

	/**
	 * 底层已经默认使用jackson来解析对象了，可以从maven引用里看到jackson包
	 * 
	 * @return
	 */
	@RequestMapping("/gp")
	public Person1 getPerson() {
		Person1 p = new Person1();
		p.setName("静静");
		p.setAge(10);
		p.setCreateTime(new Date());
		return p;
	}

	@RequestMapping("/exception")
	public String exception(int i) throws Exception {
		if (i == 0)
			throw new Exception("测试异常");
		return "ok";
	}

}
